package com.yt.server.db.threadModel;

import com.yt.server.db.DBSupport;
import com.yt.server.db.model.DBModel;
import com.yt.server.threadpool.model.ThreadModel;
import com.yt.server.utils.ReflectionUtils;

/**
 * 数据异步查询线程model
 */
public class SelectThreadModel extends ThreadModel {
	protected String methodName;
	protected Object object;

	public SelectThreadModel() {
		this.setType("dbSelect");
		this.setTimeOut(1000);
	}

	public SelectThreadModel(Object object, String methodName) {
		this.object = object;
		this.methodName = methodName;
		this.setType("dbSelect");
		this.setTimeOut(1000);
	}

	@Override
	public void excute(Object... args) {
		try {
			/*
			if (args != null && args.length != 0) {
				DBModel dbModel = null;
				if ((Boolean) args[4]) {
					dbModel = DBSupport.getInstance().executeCacheQuery(
							(String) args[0], (String) args[1]);
				} else {
					dbModel = DBSupport.getInstance().executeQuery(
							(String) args[0], (String) args[1]);
				}

				this.object = args[2];
				this.methodName = (String) args[3];

				ReflectionUtils.invokeMethod(this.object, this.methodName,
						dbModel);
				dbModel = null;
			}
			*/
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}